home
***
CD-ROM
|
disk
|
FTP
|
other
***
search
/
Aminet 28
/
Aminet 28 (1998)(GTI - Schatztruhe)[!][Dec 1998].iso
/
Aminet
/
dev
/
gui
/
gui4cli.lha
/
Gui4Cli
/
Ext
/
GCSound
/
GCSound.gc
< prev
next >
Wrap
Text File
|
1998-10-22
|
14KB
|
560 lines
G4C
WINBIG 275 29 250 136 'GCSound 8SVX Player'
WinType 11110001
; ===============================================================
; general events
; ===============================================================
xOnLoad
mode = DIR ; can be SAMPLE or DIR
selswitch = 0 ; delect/deselect dir lv switch
setgad #this 10 hide ; hide the samples lv
setgad gcsound.gc 2 HIDE ; and it's text box
GuiOpen #this
name = '' ; set these for safety
volume = 64
speed = -1
times = 0
status = IDLE
setwin = CLOSED
gcsound.set/oldspeed = -1
lvuse gcsound.gc 1
setwintitle #this '$$lv.dir '
run 'guis:ext/gcsound/gcsound' ; load extension
xOnClose
guiclose #this
setgad #this 5 on ; appicon on
xOnQuit
guiquit gcsound.pop
guiquit gcsound.set
call gcsound quit
xOnRMB
if $mode = SAMPLE
guiopen gcsound.pop
else
; dir mode - quit any playing sounds
call gcsound stop ; stop all sounds
endif
xOnFail
guiwindow #this resume
xAppicon -1 -1 :gcsound.gc 'GCSound' '' OFF
gadid 5
guiopen #this
setgad #this 5 off
; ===============================================================
; the dir listview
; ===============================================================
XLISTVIEW 0 12 250 124 "" file "" 0 DIR
gadid 1
gadfont #mono 8 000
; on choosing a file by double click, play it..
call gcsound sound $file 0 64 -1
xlvdirhook 1
setwintitle #this '$$lv.dir '
; ===============================================================
; the samples listview - (should make it DBase)
; ===============================================================
XLISTVIEW 0 12 250 124 "" sample t:soundtemp 5 MULTI
gadid 10
gadfont #mono 8 000
gosub gcsound.set settings '$sample' ; set vol, speed etc
; ===============================================================
; the status box
; ===============================================================
TEXT 1 1 248 11 "Idle.." 40 BOX
gadid 2
; ===============================================================
; dir lv control buttons
; ===============================================================
XBUTTON 0 0 30 12 "P"
gadid 50
lvuse #this 1
lvdir parent
setwintitle #this '$$lv.dir '
XBUTTON 30 0 30 12 "D"
gadid 50
lvuse #this 1
lvdir disks
setwintitle #this 'Disks'
XBUTTON 60 0 30 12 "S"
gadid 50
lvuse #this 1
if $selswitch = 1
lvdir all
selswitch = 0
else
lvdir none
selswitch = 1
endif
; ===============================================================
; dir lv - add selected
; ===============================================================
XBUTTON 130 0 70 12 "Add"
gadid 50
lvuse gcsound.gc 1
lvmulti first
while $$lv.line > '' ; skip dirs
and $$lv.type == DIR
lvmulti next
endwhile
while $$lv.line > '' ; skip dirs
if $file H= 'FORM????8SVX'
lvuse gcsound.gc 10
lvsearch '$file' ci first ; avoid duplicate entries
if $$lv.line = ''
extract file file fname
rec = ' '
rec[0][30] = $fname
appvar rec '0 64 -1 $file'
lvadd $rec
endif
lvuse gcsound.gc 1
endif
lvmulti off
lvmulti next
endwhile
; ===============================================================
; dir lv - switch to samples lv
; ===============================================================
XBUTTON 200 0 50 12 "Ok"
gadid 50
gcsound.gc/mode = SAMPLE
setgad gcsound.gc 10 SHOW ; show the samples lv
setgad gcsound.gc 2 SHOW ; show the textin gad
setgad gcsound.gc 1 HIDE ; hide dir lv
setgad gcsound.gc 50 HIDE ; hide all dir lv gads
redraw gcsound.gc
setwintitle gcsound.gc 'GCSound 8SVX player'
; ===============================================================
; ROUTINE - Split the line into it's components
; ===============================================================
xRoutine splitline line
; split the line into it's components
origline = '$line' ; store original line
parsevar line
; get name & mode
name = $$parse.0
if $name[0][5] = '
'
status = LOAD
name = $name[5]
elseif $name[0][7] = '
'
status = PLAY
name = $name[7]
else
status = IDLE
endif
extract name clean name
times = $$parse.1
extract times clean times
volume = $$parse.2
extract volume clean volume
speed = $$parse.3
extract speed clean speed
path = $$parse.4
extract path clean path
if $setwin = OPEN
gosub gcsound.set initsetgads
endif
; ===============================================================
; ROUTINE - Join the line & put it back in the list
; ===============================================================
xRoutine joinline
rec = ' '
rec[0][30] = $name
appvar rec '$times $volume $speed $path'
; add esc seq
if $status = PLAY
rec = '
$rec'
elseif $status = LOAD
rec = '
$rec'
endif
; ===============================================================
; ROUTINE - find line place & put it
; ===============================================================
xRoutine putline
; look for old line & replace it
lvuse gcsound.gc 10
lvsearch '$path' ci first
if $$lv.line > ''
lvput '$rec'
else
ezreq 'Sample $name was removed!' OK ''
endif
; %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
; +++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
; ###############################################################
NEWFILE gcsound.pop ; pop-up on RMB - SAMPLE mode
; ###############################################################
; +++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
; %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
WinBig 0 0 80 105 ""
WinType 00001000
winonmouse 30 22
varpath gcsound.gc
xOnRMB
guiclose #this
xOnInactive
guiclose #this
; ===============================================================
; Change to dir lv
; ===============================================================
XBUTTON 0 0 0 15 "<< Select"
guiclose #this
setgad gcsound.gc 1 SHOW
setgad gcsound.gc 50 SHOW
setgad gcsound.gc 10 HIDE
setgad gcsound.gc 2 HIDE
redraw gcsound.gc
gcsound.gc/mode = DIR
lvuse gcsound.gc 1
setwintitle gcsound.gc '$$lv.dir '
lvuse gcsound.gc 10
lvmulti all
gosub gcsound.pop abort ; abort all playing sounds
; ===============================================================
; Play selected sample
; ===============================================================
XBUTTON 0 15 0 15 "Play"
gadhelp 'Play first selected samples'
guiclose #this
lvuse gcsound.gc 10
lvmulti first
while $$lv.line > ''
gosub gcsound.gc splitline '$sample'
if $status = LOAD
call gcsound play $name $times $volume $speed
status = PLAY
gosub gcsound.gc joinline
lvput '$rec'
elseif $status = IDLE
call gcsound load $path $name
call gcsound play $name $times $volume $speed
status = PLAY
gosub gcsound.gc joinline
lvput '$rec'
endif
if $$retcode > 0 ; error = audio is full
lvmulti none
stop
endif
lvmulti off
lvmulti next
endwhile
lvsort ASC
; ===============================================================
; stop current/All sample
; ===============================================================
XBUTTON 0 30 60 15 "Stop"
gadhelp 'Abort selected sample'
guiclose #this
lvuse gcsound.gc 10
gosub #this abort
xroutine abort ; also used below
lvmulti first
while $$lv.line > ''
if $sample[4][1] = ';'
gosub gcsound.gc splitline '$sample'
call gcsound stop $name
status = LOAD
gosub gcsound.gc joinline
lvput '$rec' ; set plain white
update gcsound.gc 2 'Stoped $name'
endif
lvmulti off
lvmulti next
endwhile
XBUTTON 60 30 20 15 "A" ; stop all samples
gadhelp 'Abort all samples'
guiclose #this
lvuse gcsound.gc 10
lvmulti all
setgad gcsound.gc 10 HIDE ; for speed
guiwindow gcsound.gc wait
gosub #this abort
setgad gcsound.gc 10